﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace BanHangCshap.Class.gkhtdl63.DAL
{
    public abstract class ChitietQCBoSanphamDAL:clsBaseDAL
    {
        public DataTable ChitietQCBoSanpham_LayTheoId(Guid xlId)
        {
            string xlSPName = "sp_ChitietQCBoSanpham_LayTheoId";
            string[] xlSPPara = { "@Id" };
            object[] xlSPValu = { xlId };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }

        public DataTable ChitietQCBoSanpham_LayTheoMa_QCBoSanpham(string xlMa_QCBoSanpham)
        {
            string xlSPName = "sp_ChitietQCBoSanpham_LayTheoMa_QCBoSanpham";
            string[] xlSPPara = { "@Ma_QCBoSanpham" };
            string[] xlSPValu = { xlMa_QCBoSanpham };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }

        public DataTable ChitietQCBoSanpham_LayHiendungMoinhat(string xlMa_BoSanpham)
        {
            string xlSPName = "sp_ChitietQCBoSanpham_LayHiendungMoinhat";
            string[] xlSPPara = { "@Ma_BoSanpham" };
            string[] xlSPValu = { xlMa_BoSanpham };
            return base.Select(xlSPName, xlSPPara, xlSPValu);
        }

        public bool ChitietQCBoSanpham_Them(DAL.Entities.ChitietQCBoSanpham xlCTQCBSP)
        {
            string xlSPName = "sp_ChitietQCBoSanpham_Them";
            string[] xlSPPara = {  
                                    "@Id"
                                    ,"@STT"
                                    ,"@Ma_Hanghoa"
                                    ,"@Ma_QCBoSanpham"
                                    ,"@SLChuaquydoi"
                                    ,"@DVT"
                                    ,"@Giaxuat"
                                    ,"@Thanhtien"
                                    ,"@TyleQuydoi"
                                    ,"@SoluongGoc"
                                    ,"@Ghichu"
                                };

            object[] xlSPValu = {   
                                    xlCTQCBSP.Id
                                    ,xlCTQCBSP.STT
                                    ,xlCTQCBSP.Ma_Hanghoa
                                    ,xlCTQCBSP.Ma_QCBoSanpham
                                    ,xlCTQCBSP.SLChuaquydoi
                                    ,xlCTQCBSP.DVT
                                    ,xlCTQCBSP.Giaxuat
                                    ,xlCTQCBSP.Thanhtien
                                    ,xlCTQCBSP.TyleQuydoi
                                    ,xlCTQCBSP.SoluongGoc
                                    ,xlCTQCBSP.Ghichu
                                 };
            return base.Insert(xlSPName, xlSPPara, xlSPValu);
        }

        public bool ChitietQCBoSanpham_Capnhat(DAL.Entities.ChitietQCBoSanpham xlCTQCBSP, Guid IdCu)
        {
            string xlSPName = "sp_ChitietQCBoSanpham_Capnhat";
            string[] xlSPPara = {  
                                    "@IdCu"                        
                                    ,"@Id"
                                    ,"@STT"
                                    ,"@Ma_Hanghoa"
                                    ,"@Ma_QCBoSanpham"
                                    ,"@SLChuaquydoi"
                                    ,"@DVT"
                                    ,"@Giaxuat"
                                    ,"@Thanhtien"
                                    ,"@TyleQuydoi"
                                    ,"@SoluongGoc"
                                    ,"@Ghichu"
                                };

            object[] xlSPValu = {   
                                    IdCu
                                    ,xlCTQCBSP.Id
                                    ,xlCTQCBSP.STT
                                    ,xlCTQCBSP.Ma_Hanghoa
                                    ,xlCTQCBSP.Ma_QCBoSanpham
                                    ,xlCTQCBSP.SLChuaquydoi
                                    ,xlCTQCBSP.DVT
                                    ,xlCTQCBSP.Giaxuat
                                    ,xlCTQCBSP.Thanhtien
                                    ,xlCTQCBSP.TyleQuydoi
                                    ,xlCTQCBSP.SoluongGoc
                                    ,xlCTQCBSP.Ghichu
                                 };
            return base.Update(xlSPName, xlSPPara, xlSPValu);
        }

        public bool ChitietQCBoSanpham_Xoa(string Ma_QCBoSanpham)
        {
            string xlSPName = "sp_ChitietQCBoSanpham_Xoa";
            string[] xlSPPara = {"@Ma_QCBoSanpham"};
            object[] xlSPValu = {Ma_QCBoSanpham};
            return base.Delete(xlSPName, xlSPPara, xlSPValu);
        }
    }
}
